<template>
	<view class="body">
		<view class="box">
			<image src="../../static/image/coupon02.png" class="logo" mode="widthFix"></image>
			<view class="center">
				<view class="option">
					券码：<span class="value">{{orderDetail.code}}</span>
				</view>
				<view class="option">
					有效期：<span class="value">{{orderDetail.lifespan}}</span>
				</view>
				<view class="option">
					已返款：<span class="value">{{orderDetail.useTime}}</span>
				</view>
			</view>
			<view class="right" @click="showBig">
				<image src="../../static/image/code.png" mode="widthFix" class="code"></image>
				<view class="code_text">
					查看原图
				</view>
			</view>
		</view>
		<Movable @close='close' :imgVal='orderDetail.couponCode' v-if='isShow'></Movable>
	</view>
</template>

<script>
	import Movable from '@/compontents/Movable.vue'
	import {
		cardDetail
	} from '@/api.js'
	export default {
		components: {
			Movable
		},
		data() {
			return {
				isShow: false,
				id: '',
				orderDetail: {}
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetail()
		},
		methods: {
			async getDetail() {
				const res = await cardDetail({
					id: this.id
				})
				this.orderDetail = res.result
			},
			close() {
				this.isShow = false
			},
			showBig() {
				this.isShow = true
			},
		}
	}
</script>

<style scoped lang="scss">
	.body {
		width: 750rpx;
		height: 100vh;
		background: #f9f9f9;
		padding: 60rpx 0;
		box-sizing: border-box;

		.box {
			width: 710rpx;
			margin: 0 auto;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background: #fff;
			padding: 10rpx 20rpx;

			.logo {
				width: 100rpx;
			}

			.center {
				min-width: 400rpx;

				.option {
					font-size: 28rpx;

					.value {
						font-size: 24rpx;
						color: #999;

					}
				}



			}

			.right {
				display: flex;
				flex-direction: column;
				align-items: center;

				.code {
					width: 60rpx;
				}

				.code_text {
					white-space: nowrap;
					background: #f9f9f9;
					font-size: 32rpx;
					padding: 4rpx 10rpx;
				}
			}
		}
	}
</style>